package cn.arikeky.service.impl;

import cn.arikeky.domain.Writer;
import cn.arikeky.mapper.WriterMapper;
import cn.arikeky.service.WriterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class WriterServiceImpl implements WriterService {

    @Autowired
    private WriterMapper writerMapper;

    @Override
    public List<Writer> findWAll() {
        return writerMapper.findWAll();
    }

    @Override
    @Transactional
    public void addW(Writer writer) {
        writerMapper.addW(writer);
    }

    @Override
    @Transactional
    public void updateW(Writer writer) {
        writerMapper.updateW(writer);
    }

    @Override
    @Transactional
    public void deleteW(Long id) {
        writerMapper.deleteW(id);
    }

    @Override
    public Writer findWById(Long id) {
        return writerMapper.findWById(id);
    }
}
